﻿using System;
using DslModeling=global::Microsoft.VisualStudio.Modeling;
using DslDiagrams=global::Microsoft.VisualStudio.Modeling.Diagrams;
using DslValidation=global::Microsoft.VisualStudio.Modeling.Validation;

namespace Salamanca.Sdml
{

    partial class NamedElement
    {
        partial class NamePropertyHandler
        {
            protected override void OnValueChanging(NamedElement element, string oldValue, string newValue)
            {
                if (!element.Store.InUndoRedoOrRollback)
                    if (string.IsNullOrEmpty(newValue))
                        throw new ArgumentOutOfRangeException("Name", Resources.SR.NameCannotBeNull);

                base.OnValueChanging(element, oldValue, newValue);
            }
        }
    }
}
